﻿using System;
using Contracts.Entities;
using Model.Movie;

namespace Client.Processes
{
    public class SaveMovie
    {
        private WriteMovieItem writer;
        private ReadMovieItem reader;

        public SaveMovie()
        {
            this.writer = new WriteMovieItem();
            this.reader = new ReadMovieItem();
            this.reader.OnCompleted += m => OnCompleted(m);
        }

        public void Process(MovieItem item)
        {
            writer.Update(item);
            reader.Process(item.Id);
        }

        public event Action<MovieItem> OnCompleted;
    }
}
